#pragma once
#include<string>
#include<typeinfo>
#include<sstream>


namespace DBModel
{

	class Equipment
	{
	public:
		Equipment() {}
		~Equipment() {}

		int id = 0;
		int userId = 0;
		int base_id = 0;
		int level = 0;
		int rank_lv = 0;


		std::string operator[](const int& index)
		{
			switch (index)
			{
			case 1:
				return std::to_string(id);
			case 2:
				return std::to_string(userId);
			case 3:
				return std::to_string(base_id);
			case 4:
				return std::to_string(level);
			case 5:
				return std::to_string(rank_lv);

			default:
				return "";
			}
		}

		void set(const int& index, char* value)
		{
			switch (index)
			{
			case 1:
				id = std::atoi(value);
			case 2:
				userId = std::atoi(value);
			case 3:
				base_id = std::atoi(value);
			case 4:
				level = std::atoi(value);
			case 5:
				rank_lv = std::atoi(value);

			default:
				break;
			}
		}

		std::string getDataType(int index)
		{
			switch (index)
			{
			case 1:
				return typeid(id).name();
			case 2:
				return typeid(userId).name();
			case 3:
				return typeid(base_id).name();
			case 4:
				return typeid(level).name();
			case 5:
				return typeid(rank_lv).name();

			default:
				return "";
			}
		}

		std::string getAttributeName(const int& index)
		{
			switch (index)
			{
			case 1:
				return "id";
			case 2:
				return "userId";
			case 3:
				return "base_id";
			case 4:
				return "level";
			case 5:
				return "rank_lv";

			default:
				return "";
			}
		}

		bool isValid(int index)
		{
			switch (index)
			{
			case 1:
				return id > 0;
			case 2:
				return userId > 0;
			case 3:
				return base_id > 0;
			case 4:
				return level > 0;
			case 5:
				return rank_lv > 0;

			default:
				return false;
			}
		}

		std::string getName()
		{
			return "equipment";
		}

		int getAttributeNums()
		{
			return 5;
		}
	};



	class Items
	{
	public:
		Items() {}
		~Items() {}

		int id = 0;
		int userId = 0;
		int nums = 0;


		std::string operator[](const int& index)
		{
			switch (index)
			{
			case 1:
				return std::to_string(id);
			case 2:
				return std::to_string(userId);
			case 3:
				return std::to_string(nums);

			default:
				return "";
			}
		}

		void set(const int& index, char* value)
		{
			switch (index)
			{
			case 1:
				id = std::atoi(value);
			case 2:
				userId = std::atoi(value);
			case 3:
				nums = std::atoi(value);

			default:
				break;
			}
		}

		std::string getDataType(int index)
		{
			switch (index)
			{
			case 1:
				return typeid(id).name();
			case 2:
				return typeid(userId).name();
			case 3:
				return typeid(nums).name();

			default:
				return "";
			}
		}

		std::string getAttributeName(const int& index)
		{
			switch (index)
			{
			case 1:
				return "id";
			case 2:
				return "userId";
			case 3:
				return "nums";

			default:
				return "";
			}
		}

		bool isValid(int index)
		{
			switch (index)
			{
			case 1:
				return id > 0;
			case 2:
				return userId > 0;
			case 3:
				return nums > 0;

			default:
				return false;
			}
		}

		std::string getName()
		{
			return "items";
		}

		int getAttributeNums()
		{
			return 3;
		}
	};



	class Mails
	{
	public:
		Mails() {}
		~Mails() {}

		int id = 0;
		int userId = 0;
		std::string item_type = "";
		std::string item_value = "";
		std::string item_size = "";
		std::string title = "";
		std::string content = "";


		std::string operator[](const int& index)
		{
			switch (index)
			{
			case 1:
				return std::to_string(id);
			case 2:
				return std::to_string(userId);
			case 3:
				return item_type;
			case 4:
				return item_value;
			case 5:
				return item_size;
			case 6:
				return title;
			case 7:
				return content;

			default:
				return "";
			}
		}

		void set(const int& index, char* value)
		{
			switch (index)
			{
			case 1:
				id = std::atoi(value);
			case 2:
				userId = std::atoi(value);
			case 3:
				item_type = value;
			case 4:
				item_value = value;
			case 5:
				item_size = value;
			case 6:
				title = value;
			case 7:
				content = value;

			default:
				break;
			}
		}

		std::string getDataType(int index)
		{
			switch (index)
			{
			case 1:
				return typeid(id).name();
			case 2:
				return typeid(userId).name();
			case 3:
				return typeid(item_type).name();
			case 4:
				return typeid(item_value).name();
			case 5:
				return typeid(item_size).name();
			case 6:
				return typeid(title).name();
			case 7:
				return typeid(content).name();

			default:
				return "";
			}
		}

		std::string getAttributeName(const int& index)
		{
			switch (index)
			{
			case 1:
				return "id";
			case 2:
				return "userId";
			case 3:
				return "item_type";
			case 4:
				return "item_value";
			case 5:
				return "item_size";
			case 6:
				return "title";
			case 7:
				return "content";

			default:
				return "";
			}
		}

		bool isValid(int index)
		{
			switch (index)
			{
			case 1:
				return id > 0;
			case 2:
				return userId > 0;
			case 3:
				return item_type != "";
			case 4:
				return item_value != "";
			case 5:
				return item_size != "";
			case 6:
				return title != "";
			case 7:
				return content != "";

			default:
				return false;
			}
		}

		std::string getName()
		{
			return "mails";
		}

		int getAttributeNums()
		{
			return 7;
		}
	};



	class Modelglobalid
	{
	public:
		Modelglobalid() {}
		~Modelglobalid() {}

		std::string idmodelGlobalId = "";
		int globalId = 0;


		std::string operator[](const int& index)
		{
			switch (index)
			{
			case 1:
				return idmodelGlobalId;
			case 2:
				return std::to_string(globalId);

			default:
				return "";
			}
		}

		void set(const int& index, char* value)
		{
			switch (index)
			{
			case 1:
				idmodelGlobalId = value;
			case 2:
				globalId = std::atoi(value);

			default:
				break;
			}
		}

		std::string getDataType(int index)
		{
			switch (index)
			{
			case 1:
				return typeid(idmodelGlobalId).name();
			case 2:
				return typeid(globalId).name();

			default:
				return "";
			}
		}

		std::string getAttributeName(const int& index)
		{
			switch (index)
			{
			case 1:
				return "idmodelGlobalId";
			case 2:
				return "globalId";

			default:
				return "";
			}
		}

		bool isValid(int index)
		{
			switch (index)
			{
			case 1:
				return idmodelGlobalId != "";
			case 2:
				return globalId > 0;

			default:
				return false;
			}
		}

		std::string getName()
		{
			return "modelglobalid";
		}

		int getAttributeNums()
		{
			return 2;
		}
	};



	class Player
	{
	public:
		Player() {}
		~Player() {}

		int id = 0;
		std::string name = "";
		int level = 0;
		int base_id = 0;


		std::string operator[](const int& index)
		{
			switch (index)
			{
			case 1:
				return std::to_string(id);
			case 2:
				return name;
			case 3:
				return std::to_string(level);
			case 4:
				return std::to_string(base_id);

			default:
				return "";
			}
		}

		void set(const int& index, char* value)
		{
			switch (index)
			{
			case 1:
				id = std::atoi(value);
			case 2:
				name = value;
			case 3:
				level = std::atoi(value);
			case 4:
				base_id = std::atoi(value);

			default:
				break;
			}
		}

		std::string getDataType(int index)
		{
			switch (index)
			{
			case 1:
				return typeid(id).name();
			case 2:
				return typeid(name).name();
			case 3:
				return typeid(level).name();
			case 4:
				return typeid(base_id).name();

			default:
				return "";
			}
		}

		std::string getAttributeName(const int& index)
		{
			switch (index)
			{
			case 1:
				return "id";
			case 2:
				return "name";
			case 3:
				return "level";
			case 4:
				return "base_id";

			default:
				return "";
			}
		}

		bool isValid(int index)
		{
			switch (index)
			{
			case 1:
				return id > 0;
			case 2:
				return name != "";
			case 3:
				return level > 0;
			case 4:
				return base_id > 0;

			default:
				return false;
			}
		}

		std::string getName()
		{
			return "player";
		}

		int getAttributeNums()
		{
			return 4;
		}
	};



	class Player_skill
	{
	public:
		Player_skill() {}
		~Player_skill() {}

		int id = 0;
		int skill_1 = 0;
		int skill_2 = 0;
		int skill_3 = 0;
		int level_1 = 0;
		int level_2 = 0;
		int level_3 = 0;


		std::string operator[](const int& index)
		{
			switch (index)
			{
			case 1:
				return std::to_string(id);
			case 2:
				return std::to_string(skill_1);
			case 3:
				return std::to_string(skill_2);
			case 4:
				return std::to_string(skill_3);
			case 5:
				return std::to_string(level_1);
			case 6:
				return std::to_string(level_2);
			case 7:
				return std::to_string(level_3);

			default:
				return "";
			}
		}

		void set(const int& index, char* value)
		{
			switch (index)
			{
			case 1:
				id = std::atoi(value);
			case 2:
				skill_1 = std::atoi(value);
			case 3:
				skill_2 = std::atoi(value);
			case 4:
				skill_3 = std::atoi(value);
			case 5:
				level_1 = std::atoi(value);
			case 6:
				level_2 = std::atoi(value);
			case 7:
				level_3 = std::atoi(value);

			default:
				break;
			}
		}

		std::string getDataType(int index)
		{
			switch (index)
			{
			case 1:
				return typeid(id).name();
			case 2:
				return typeid(skill_1).name();
			case 3:
				return typeid(skill_2).name();
			case 4:
				return typeid(skill_3).name();
			case 5:
				return typeid(level_1).name();
			case 6:
				return typeid(level_2).name();
			case 7:
				return typeid(level_3).name();

			default:
				return "";
			}
		}

		std::string getAttributeName(const int& index)
		{
			switch (index)
			{
			case 1:
				return "id";
			case 2:
				return "skill_1";
			case 3:
				return "skill_2";
			case 4:
				return "skill_3";
			case 5:
				return "level_1";
			case 6:
				return "level_2";
			case 7:
				return "level_3";

			default:
				return "";
			}
		}

		bool isValid(int index)
		{
			switch (index)
			{
			case 1:
				return id > 0;
			case 2:
				return skill_1 > 0;
			case 3:
				return skill_2 > 0;
			case 4:
				return skill_3 > 0;
			case 5:
				return level_1 > 0;
			case 6:
				return level_2 > 0;
			case 7:
				return level_3 > 0;

			default:
				return false;
			}
		}

		std::string getName()
		{
			return "player_skill";
		}

		int getAttributeNums()
		{
			return 7;
		}
	};



	class Resource
	{
	public:
		Resource() {}
		~Resource() {}

		int id = 0;
		int userId = 0;
		int num = 0;


		std::string operator[](const int& index)
		{
			switch (index)
			{
			case 1:
				return std::to_string(id);
			case 2:
				return std::to_string(userId);
			case 3:
				return std::to_string(num);

			default:
				return "";
			}
		}

		void set(const int& index, char* value)
		{
			switch (index)
			{
			case 1:
				id = std::atoi(value);
			case 2:
				userId = std::atoi(value);
			case 3:
				num = std::atoi(value);

			default:
				break;
			}
		}

		std::string getDataType(int index)
		{
			switch (index)
			{
			case 1:
				return typeid(id).name();
			case 2:
				return typeid(userId).name();
			case 3:
				return typeid(num).name();

			default:
				return "";
			}
		}

		std::string getAttributeName(const int& index)
		{
			switch (index)
			{
			case 1:
				return "id";
			case 2:
				return "userId";
			case 3:
				return "num";

			default:
				return "";
			}
		}

		bool isValid(int index)
		{
			switch (index)
			{
			case 1:
				return id > 0;
			case 2:
				return userId > 0;
			case 3:
				return num > 0;

			default:
				return false;
			}
		}

		std::string getName()
		{
			return "resource";
		}

		int getAttributeNums()
		{
			return 3;
		}
	};



	class User
	{
	public:
		User() {}
		~User() {}

		int id = 0;
		std::string name = "";
		std::string password = "";
		int level = 0;
		int base_id = 0;


		std::string operator[](const int& index)
		{
			switch (index)
			{
			case 1:
				return std::to_string(id);
			case 2:
				return name;
			case 3:
				return password;
			case 4:
				return std::to_string(level);
			case 5:
				return std::to_string(base_id);

			default:
				return "";
			}
		}

		void set(const int& index, char* value)
		{
			switch (index)
			{
			case 1:
				id = std::atoi(value);
			case 2:
				name = value;
			case 3:
				password = value;
			case 4:
				level = std::atoi(value);
			case 5:
				base_id = std::atoi(value);

			default:
				break;
			}
		}

		std::string getDataType(int index)
		{
			switch (index)
			{
			case 1:
				return typeid(id).name();
			case 2:
				return typeid(name).name();
			case 3:
				return typeid(password).name();
			case 4:
				return typeid(level).name();
			case 5:
				return typeid(base_id).name();

			default:
				return "";
			}
		}

		std::string getAttributeName(const int& index)
		{
			switch (index)
			{
			case 1:
				return "id";
			case 2:
				return "name";
			case 3:
				return "password";
			case 4:
				return "level";
			case 5:
				return "base_id";

			default:
				return "";
			}
		}

		bool isValid(int index)
		{
			switch (index)
			{
			case 1:
				return id > 0;
			case 2:
				return name != "";
			case 3:
				return password != "";
			case 4:
				return level > 0;
			case 5:
				return base_id > 0;

			default:
				return false;
			}
		}

		std::string getName()
		{
			return "user";
		}

		int getAttributeNums()
		{
			return 5;
		}
	};



}